package com.example.unisys.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.unisys.entity.Notice;
import com.example.unisys.dao.NoticeMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class NoticeService extends ServiceImpl<NoticeMapper,Notice> {



    public Integer insert(Notice notice){
        return baseMapper.insertSelective(notice);
    }

    public Integer update(Notice notice){
        return baseMapper.update(notice);
    }

    public List<Map< String, Object >> getNoticeBySchool(String main_school, String sub_school, int start, int pagesize){
        return baseMapper.getNoticeBySchool(main_school,sub_school,start,pagesize);
    }

    public Integer getNoticeSum(String main_school,String sub_school){
        return baseMapper.getNoticeSum(main_school,sub_school);
    }

    public Integer delete(int notice_id){
        return baseMapper.delete(notice_id);
    }

    public Notice getById(int notice_id){
        return baseMapper.getById(notice_id);
    }

    public List<Map<String, Object>> getNoticesWirthType(HashMap<String, Object> hs) {
        return baseMapper.getNoticesWithType(hs);
    }
}
